﻿#include <CommonUnits/Units/Inductance.h>
#include <gtest/gtest.h>

TEST(InductanceTest, CastTest)
{
    EXPECT_EQ(CU::Henry(1e3), CU::Kilohenry(1));
    EXPECT_EQ(CU::Kilohenry(1e3), CU::Megahenry(1));
    EXPECT_EQ(CU::Megahenry(1e3), CU::Gigahenry(1));
    EXPECT_EQ(CU::Gigahenry(1e3), CU::Terahenry(1));
    EXPECT_EQ(CU::Terahenry(1e3), CU::Petahenry(1));
    EXPECT_EQ(CU::Petahenry(1e3), CU::Exahenry(1));
    EXPECT_EQ(CU::Millihenry(1e3), CU::Henry(1));
    EXPECT_EQ(CU::Microhenry(1e3), CU::Millihenry(1));
    EXPECT_EQ(CU::Nanohenry(1e3), CU::Microhenry(1));
    EXPECT_EQ(CU::Picohenry(1e3), CU::Nanohenry(1));
    EXPECT_EQ(CU::Femtohenry(1e3), CU::Picohenry(1));
    EXPECT_EQ(CU::Attohenry(1e3), CU::Femtohenry(1));
}

TEST(InductanceTest, Literals)
{
    using namespace CU::Inductance::Literals;
    EXPECT_EQ(1e3_H, 1.0_kH);
    EXPECT_EQ(1e3_kH, 1.0_MH);
    EXPECT_EQ(1e3_MH, 1.0_GH);
    EXPECT_EQ(1e3_GH, 1.0_TH);
    EXPECT_EQ(1e3_TH, 1.0_PH);
    EXPECT_EQ(1e3_PH, 1.0_EH);
    EXPECT_EQ(1e3_mH, 1.0_H);
    EXPECT_EQ(1e3_uH, 1.0_mH);
    EXPECT_EQ(1e3_nH, 1.0_uH);
    EXPECT_EQ(1e3_pH, 1.0_nH);
    EXPECT_EQ(1e3_fH, 1.0_pH);
    EXPECT_EQ(1e3_aH, 1.0_fH);
}

TEST(InductanceTest, ToUnit)
{
    using namespace CU::Inductance::Literals;
    EXPECT_EQ(1e3_H, CU::Inductance::toUnit<CU::Henry>(1, CU::Kilohenry::unit()));
    EXPECT_EQ(1e3_kH, CU::Inductance::toUnit<CU::Kilohenry>(1, CU::Megahenry::unit()));
    EXPECT_EQ(1e3_MH, CU::Inductance::toUnit<CU::Megahenry>(1, CU::Gigahenry::unit()));
    EXPECT_EQ(1e3_GH, CU::Inductance::toUnit<CU::Gigahenry>(1, CU::Terahenry::unit()));
    EXPECT_EQ(1e3_TH, CU::Inductance::toUnit<CU::Terahenry>(1, CU::Petahenry::unit()));
    EXPECT_EQ(1e3_PH, CU::Inductance::toUnit<CU::Petahenry>(1, CU::Exahenry::unit()));
    EXPECT_EQ(1e3_mH, CU::Inductance::toUnit<CU::Millihenry>(1, CU::Henry::unit()));
    EXPECT_EQ(1e3_uH, CU::Inductance::toUnit<CU::Microhenry>(1, CU::Millihenry::unit()));
    EXPECT_EQ(1e3_nH, CU::Inductance::toUnit<CU::Nanohenry>(1, CU::Microhenry::unit()));
    EXPECT_EQ(1e3_pH, CU::Inductance::toUnit<CU::Picohenry>(1, CU::Nanohenry::unit()));
    EXPECT_EQ(1e3_fH, CU::Inductance::toUnit<CU::Femtohenry>(1, CU::Picohenry::unit()));
    EXPECT_EQ(1e3_aH, CU::Inductance::toUnit<CU::Attohenry>(1, CU::Femtohenry::unit()));
}

int main(int argc, char* argv[])
{
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}